utils.fetch('./api/users/chongming.php').then(resp1 => {
    if (resp1.code === 200) {
      var { list } = resp1.body
      console.log(list)
      document.querySelector('button').onclick = function () {
        const username = document.querySelector('#username').value
        const pwd = document.querySelector('#password').value
        if(list.some((ele)=>(ele.username == username))){
            alert("用户名已被注册，请重新填写")
            location.reload
        }else{
            utils.fetch('./api/users/register.php',{ username, pwd}).then(resp => {
                if(resp.code === 200){
                    // 注册成功
                    alert('注册成功，即将跳转登录页')
                    window.open('./login.html', '_self')
                }else{
                    alert('网络异常，请重试')
                }
            })
        }
    }
    }
})